<h1><%= @job.created_at.to_date.to_s(:long) %></h1>

<div id="spectrum" ></div>

<% if @job.fragments.selected.size > 0 %>
<table class="fragment-list">
  <tr>
    <th title="<%= t '.tooltip.peaknum' %>"><%= t '.peaknum' %></th>
    <th title="<%= t '.tooltip.formula' %>"><%= t '.formula' %></th>
    <th title="<%= t '.tooltip.mass' %>"><%= t '.mass' %></th>
    <th title="<%= t '.tooltip.massdiff' %>"><%= t '.massdiff' %></th>
    <th title="<%= t '.tooltip.rank' %>"><%= t '.rank' %></th>
    <th title="<%= t '.tooltip.score' %>"><%= t '.score' %></th>
    <th title="<%= t '.tooltip.bonds' %>"><%= t '.bonds' %></th>
    <th title="<%= t '.tooltip.energy' %>"><%= t '.energy' %></th>
    <th title="<%= t '.tooltip.rr' %>"><%= t '.rr' %></th>
  </tr>
  <% @job.fragments.selected.each do |fragment| %>
  <tr>
    <td><%= fragment.peaknum %></td>
    <td>
      <%= svg_image_tag(fragment_image_path(fragment), :width => 225, :height => 150, :class => "fragment-thumb") %><br />
      <span class="chemical-formula"><%= format_chemical_formula(fragment.formula) %></span>
    </td>
    <td><%= format_mass(fragment.peakmass) %><br /><%= format_mass(fragment.mass) %></td>
    <td><%= format_diff(fragment.massdiff) %></td>
    <td><%= fragment.rank %></td>
    <td><span class="progressbar"><%= format_score(fragment.score) %></span></td>
    <td><%= fragment.bb %> / <%= fragment.bbh %></td>
    <td><%= fragment.bbs %> </td>
    <td><%= fragment.rr ? t('generic._yes') : t('generic._no') %></td>
  </tr>
  <% end %>
</table>
<% else %>
<span class="no-fragment-candidates"><%= t '.no_fragments_selected' %></span>
<% end %>

<h2><%= t '.calculation_settings' %></h2>

<dl id="job-parameters">
  <dt title="<%= t '.tooltip.measurement_error' %>"><%= t '.measurement_error' %></dt>
  <dd><span><%= h(@job.measurement_error) %></span> mDa</dd>

  <dt title="<%= t '.tooltip.intensity_threshold' %>"><%= t '.intensity_threshold' %></dt>
  <dd><%= h(@job.intensity_threshold) %></dd>

  <dt title="<%= t '.tooltip.new_bonds_allowed' %>"><%= t '.new_bonds_allowed' %></dt>
  <dd><%= h(@job.rr) %></dd>

  <dt title="<%= t '.tooltip.cuts' %>"><%= t '.cuts' %></dt>
  <dd><%= h(@job.cuts) %></dd>
</dl>

<% content_for :javascript do %>
$(document).ready(function() {
  $('.progressbar').progressBarify();
  Spectrum("spectrum", 960
, 300, <%= @job.peaks.to_json %>);
});
<% end %>
